<div style="padding: 15px;">
    <table id="clientTable" lay-filter="clientTable"></table>
</div>
<script type="text/html" id="bar">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
</script>
<script type="text/javascript">
    layui.use('table', function() {
        let table = layui.table;
        let Data;
        table.render({
            elem: '#clientTable'
            , url: '/client/list'
            , cols: [
                [
                    {field: 'clientId', title: '客户编号', align: 'center'}
                    , {field: 'clientName', title: '客户名称', align: 'ceter'}
                    , {field: 'clientContact', title: '客户电话', align: 'center'}
                    , {field: 'clientPhone', title: '客户手机',align: 'center'}
                    , {field: 'clientQq', title: '客户Qq',align: 'center'}
                    , {field: 'clientMail', title: '客户邮箱',align: 'center'}
                    , {field: 'firstUnit', title: '一级单位',align: 'center'}
                    , {field: 'secondUnit', title: '二级单位',align: 'center'}
                    , {field: 'thirdUnit', title: '三级单位',align: 'center'}
                    , {title: '操作', align: 'center', width: 100, toolbar: '#bar'}
                ]
            ]
            , page: true
        });

        table.on('tool(clientTable)', function (obj) { //tool是工具条事件名，参数是table原始容器的lay-filter属性值
            let layEvent = obj.event; //获得 lay-event 对应的值
            if (layEvent === 'edit') {
                layer.open({
                    type: 2,
                    title: '更新项目信息',
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['893px', '600px'],
                    content: '/router/updateClient/'+obj.data.clientId,
                });
            }
        });

    });
</script>